import authButtonList from "@/assets/json/authButtonList.json";
import http from "@/api/http";
/**
 * @name 登录模块
 */
// 用户登录
// 获取菜单列表
export const getAuthMenuListApi = () => {
  return http.get<Menu.MenuOptions[]>(`/menu`, {});
};
// 获取按钮权限
export const getAuthButtonListApi = () => {
  return authButtonList;
};
// 用户登录 API
export const loginApis = (params: { phone: string; password: string }) => {
  // 发起 POST 请求，发送用户名和密码参数
  return http.post(`/admin/login`, params);
};
// 退出登录
export const logoutApi = () => {
  return http.post(`/admin/logout`);
};
// 获取用户信息
export const getUserInfoApi = () => {
  return http.get(`/adminInfo/info`);
  // return http.get(`/admin/info`);
};

//更新管理员密码
export const putPassword = (parmas: { oldPassword: string; newPassword: string }) => {
  return http.put(`/admin/password`, parmas);
};

/**
 * 获取微信扫码登录二维码 URL
 */
export const getWxLoginQrApi = () => {
  return http.get<string>("/admin/wxLoginQr");
};

/**
 * 微信扫码登录
 */
export const wxLoginApi = (params: { code: string }) => {
  return http.post("/admin/wxLogin", params);
};
